<!DOCTYPE html>
<html>
<head>
    {% load static %}
    <title>{{ title }}</title>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    {#两种内核模式：WebKit（高速模式）和Trident（兼容模式）#}
    <meta name="viewport" content="width=device-width, initial-scale=1">
    {#移动端适配#}
    <link type="text/css" href="{% static 'css/layui.css' %}" rel="stylesheet">
</head>

<body>
<div class="layui-layout layui-layout-admin">
    {#水平导航#}
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">
            <a href="{% url 'index:index' %}">
                <p style="color: white">readeasy</p>
                {#<imgs src="{% static 'imgs/icon.jpg' %}" alt="the logo"/>#}
            </a>
        </div>
        {#导航左边#}
        {% block search %}
        {% endblock search %}
        {#导航右边  #}
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
                <a href="">
                    <img src="{% static 'imgs/icon.jpg' %}" class="layui-nav-img">
                    <span>个人中心</span>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="{% url 'reader:reader' %}">个人信息</a></dd>
                    <dd><a href="{% url 'bookshelf:bookshelf' %}">书架</a></dd>
                    <dd><a href="javascript:;">Settings</a></dd>
                    <dd><a href="{% url 'reader:logout' %}">Sign out</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
                <a href="javascript:;">
                    <i class="layui-icon layui-icon-more-vertical"></i>
                </a>
            </li>
        </ul>
    </div>
    {#左侧导航区域#}
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">所有书籍</a>
                    <dl class="layui-nav-child">
                        <dd><a href="{% url 'books:books' %}?s=readCount">阅读次数</a></dd>
                        <dd><a href="{% url 'books:books' %}?s=rating">评分</a></dd>
                        <dd><a href="{% url 'books:books' %}?s=likes">收藏数量</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">讨论</a>
                    <dl class="layui-nav-child">
                        {#                        <dd><a href="{% url 'talk:talk' %}&t=哲学">哲学讨论</a></dd>#}
                        <dd><a href="{% url 'talk:talk' %}?t=哲学">哲学讨论</a></dd>
                        <dd><a href="{% url 'talk:talk' %}?t=文学">文学讨论</a></dd>
                        <dd><a href="{% url 'talk:talk' %}">所有</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="javascript:;">阅读时间</a></li>
            </ul>
        </div>
    </div>
    {#展示内容#}
    {% block content %}
    {% endblock content %}
    {#底部    #}
    <div class="layui-footer">
        读书是与高尚人谈话。
    </div>
</div>

<script src="{% static 'layui.js' %}"></script>
<script>
    layui.use(['element', 'layer', 'util'], function () {
        var element = layui.element;
        var layer = layui.layer;
        var util = layui.util;
        var $ = layui.$;

        //头部事件
        util.event('lay-header-event', {
            menuLeft: function (othis) { // 左侧菜单事件
                layer.msg('展开左侧菜单的操作', {icon: 0});
            },
            menuRight: function () {  // 右侧菜单事件
                layer.open({
                    type: 1,
                    title: '更多',
                    content: '<div style="padding: 15px;"><div onload="displayBeijingTime()"><span>时间：</span><div id="beijingTime" style="color: #333;"></div></div></div>',
                    //显示时间
                    area: ['260px', '100%'],
                    offset: 'rt', // 右上角
                    anim: 'slideLeft',
                    shadeClose: true,
                    scrollbar: false
                });
            }
        });
    });

    function displayBeijingTime() {
        const now = new Date();
        const options = {timeZone: 'Asia/Shanghai', hour12: false};
        const formattedTime = now.toLocaleString('zh-Hans-CN', options);
        document.getElementById('beijingTime').innerHTML = formattedTime;
    }

    setInterval(displayBeijingTime, 1000); // 每秒更新一次时间

</script>
{% block script %}
{% endblock script %}
</body>
</html>